<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>

<datalist id="list">
  <div id=w>
    <input type=text id=e required>
  </div>
  <legend>
    <input id="inLegend" required>
  </legend>
</datalist>


<script>
description('Test for child elements of a datalist element.');

var e = document.getElementById('e');
shouldBeFalse('e.willValidate');
var w = document.getElementById('w');
w.parentNode.removeChild(w);
shouldBeTrue('e.willValidate');
shouldBe('w.querySelector(":invalid")', 'e');
e.parentNode.removeChild(e);
shouldBeTrue('e.willValidate');
document.body.appendChild(e);
shouldBeTrue('e.willValidate');
shouldBe('document.querySelector(":invalid")', 'e');

shouldBeFalse('document.getElementById("inLegend").willValidate');

</script>
</body>
</html>
